package com.duolai.bean;

import com.duolai.service.UserInterface;
import com.spring.annotation.Autowired;
import com.spring.annotation.Component;
import com.spring.annotation.DuolaiValue;
import com.spring.annotation.Scope;
import com.spring.interfaces.BeanNameAware;

/**
 * @program: duolai-spring-01
 * @description: 用户对象
 * @author: chaidl  ！
 * @create: 2021-09-04 13:51
 */
@Component("userService")
@Scope("prototype")
public class UserService implements UserInterface, BeanNameAware {
    @Autowired
    private OrderService orderService;
    @DuolaiValue("初始化前")
    private String test;
    private String beanName;
    @Override
    public void test() {
        System.out.println(test);
        System.out.println(orderService);
        System.out.println("对象的名称："+beanName);
    }

    @Override
    public void setBeanName(String beanName) {
        this.beanName=beanName;
    }
}
// public class UserService implements InitializingBean {
//     @Autowired
//     private OrderService orderService;
//     public void test() {
//         System.out.println(orderService);
//     }
//
//     @Override
//     public void afterPropertiesSet() {
//         System.out.println("进行了初始化");
//     }
// }
